﻿using AntdUI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Angle.Krill
{
    public partial class Options : ShadowForm
    {
        public Options()
        {
            InitializeComponent();
        }

        private void Options_Load(object sender, EventArgs e)
        {
            this.windowBar.Icon = ImageHelper.GetBitmap("fa-gear");

            this.InitializeSegMenu();
        }

        private void InitializeSegMenu()
        {
            List<SegmentedItem> segmentedItems = new List<SegmentedItem>();

            segmentedItems.Add(new SegmentedItem()
            {
                Icon = ImageHelper.GetBitmap("fa-gear"),
                Text = "常规",
                Tag = "Angle.Krill.General"
            });
            segmentedItems.Add(new SegmentedItem()
            {
                Icon = ImageHelper.GetBitmap("fa-gear"),
                Text = "关于",
                Tag = "Angle.Krill.About"
            });
            this.segMenu.Items.AddRange(segmentedItems);
            this.segMenu.SelectIndex = 0;
        }

        private void segMenu_SelectIndexChanged(object sender, int value)
        {
            if (sender is Segmented segmented)
            {
                SegmentedItem item = segmented.Items[value];

                string clsFullName = item?.Tag?.ToString();
                if (!string.IsNullOrEmpty(clsFullName))
                {
                    FormHelper.LoadFormIntoPanel(this.splitContainer.Panel2, FormHelper.InstanceForm(clsFullName));
                }
            }
        }
    }
}
